levelbar: fix a crash
authorCosimo Cecchi <cosimoc@gnome.org>
Sun, 3 Jan 2016 02:14:47 +0000 (18:14 -0800)
committerCosimo Cecchi <cosimoc@gnome.org>
Sun, 3 Jan 2016 02:44:07 +0000 (18:44 -0800)
We should not try to access a block with an index that exceeds the
number of blocks in the widget.

gtk/gtklevelbar.c

index 45d9d4a0c68be69c554e6c344d1e112fd5e4feb3..7259f85de5be5a67c8eda556cfc281bd45056919 100644 (file)
@@ -712,6 +712,8 @@ update_level_style_classes (GtkLevelBar *self)
           num_blocks = (gint) round (priv->max_value) - (gint) round (priv->min_value);
         }
 
+      num_filled = MIN (num_blocks, num_filled);
+
       classes[0] = "filled";
       classes[1] = value_class;
       for (i = 0; i < num_filled; i++)